﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace LibraryManagementSystem
{
    public partial class RegistrationEvent : Form
    {
        public RegistrationEvent()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }


        private void button1_Click(object sender, EventArgs e)
        {
            var uid = textBox1.Text;
            var pwd = textBox2.Text;
            var repwd = textBox3.Text;

            string SQl = "Data Source=.;Initial Catalog=Blogs;Integrated Security=True";
            SqlConnection sqlConnection = new SqlConnection(SQl);
            sqlConnection.Open();
            string commandString = string.Format("insert into Users(Username,Password) values('{0}','{1}',)",uid,pwd);
            SqlCommand sqlCommand = new SqlCommand(commandString,sqlConnection);
            if(sqlCommand.ExecuteNonQuery() > 0)
            {
                MessageBox.Show("注册成功！");
            } 
            else
            {
                MessageBox.Show("注册失败！");
            }

            sqlConnection.Close();
        }














        private void RegistrationEvent_Load(object sender, EventArgs e)
        {
        }

        
    }
}
